﻿#pragma once
#include "DSP.h"
#include "EnvelopDetector.h"

namespace yzrilyzr_dsp{
	ECLASS(Limiter, public DSP){
	public:
	u_normal_01 threshold=1;
	EnvelopDetector envd;
	Limiter();
	Limiter(u_time_ms attackTime,u_time_ms holdTime, u_time_ms releaseTime, u_sample threshold, u_time_ms rmsWindow);
	Limiter(u_time_ms attackTime,u_time_ms holdTime, u_time_ms releaseTime, u_sample threshold, int limitType, u_time_ms rmsWindow);
	Limiter(u_time_ms attackTime,u_time_ms holdTime, u_time_ms releaseTime, u_sample threshold);
	u_sample procDsp(u_sample v) override;
	void resetMemory() override;
	void cloneParam(DSP * obj1)override;
	std::shared_ptr<DSP> cloneDSP() override;
	void init(u_sample_rate sampleRate) override;
	yzrilyzr_lang::String toString()const override;
	};
}